﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using System.Xml;
using System.Reflection;
using System.IO;

namespace Person_Project
{
    public static class Serializator
    {
        public static void Serial(Person p)
        {
            XmlSerializer serializer = new XmlSerializer(p.GetType());
            XmlWriter writer = XmlWriter.Create("ser.xml");
            serializer.Serialize(writer, p);
            writer.Close();
        }

        public static Person Deserial(string path)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(Person));
            XmlReader reader = XmlReader.Create(path);
            return (Person)serializer.Deserialize(reader);
        }
    }
}
